//
//  XCRadioButtonCollectionViewCell.m
//  SoundOfNature
//
//  Created by 梁新昌 on 16/3/11.
//  Copyright © 2016年 梁新昌. All rights reserved.
//

#import "XCRadioButtonCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation XCRadioButtonCollectionViewCell
- (void)dealloc {
    [_LargeImageView release];
    [_tagNameLable release];
    [_quantityLable release];
    [_playButton release];
    [_radioSecModel release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.LargeImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        self.tagNameLable = [[UILabel alloc] initWithFrame:CGRectZero];
        self.quantityLable = [[XCBaseLable alloc] initWithFrame:CGRectZero];
        self.playButton = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.playButton setImage:[[UIImage imageNamed:@"Image-player"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        [self.contentView addSubview:self.LargeImageView];
        [self.contentView addSubview:self.tagNameLable];
        [self.contentView addSubview:self.playButton];
        [self.contentView addSubview:self.quantityLable];
        
        [self.tagNameLable release];
        [self.quantityLable release];
        [self.LargeImageView release];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.LargeImageView.frame = self.bounds;
    
    self.tagNameLable.frame = CGRectMake(self.bounds.size.width / 2 - 25, self.bounds.size.height / 2 - 14, 60, 21);
    self.tagNameLable.font = [UIFont systemFontOfSize:13];
    self.tagNameLable.textColor = [UIColor whiteColor];
    self.quantityLable.frame = CGRectMake(self.tagNameLable.frame.origin.x, self.tagNameLable.frame.size.height + self.tagNameLable.frame.origin.y + 5, 60, 21);
    self.playButton.frame = CGRectMake(self.bounds.size.width - 35, self.bounds.size.height - 35, 25, 25);
    self.quantityLable.font = [UIFont systemFontOfSize:12];
    self.quantityLable.textColor = [UIColor colorWithWhite:0.502 alpha:1.000];
}
- (void)setRadioSecModel:(XCRadioSecDataModel *)radioSecModel {
    
    if (_radioSecModel != radioSecModel) {
        [_radioSecModel release];
        _radioSecModel = [radioSecModel retain];
        
    }
    
    [self.LargeImageView sd_setImageWithURL:[NSURL URLWithString:radioSecModel.large_pic_url] placeholderImage:[UIImage imageNamed:@"Image-p"]];
    self.tagNameLable.text = radioSecModel.tag_name;
    self.quantityLable.text = [NSString stringWithFormat:@"%@首", radioSecModel.quantity];
    
    
}
@end
